"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.storage = void 0;
const multer_1 = __importDefault(require("multer"));
const feifanc_1 = __importDefault(require("../../util/feifanc"));
const path_1 = __importDefault(require("path"));
const rou_1 = __importDefault(require("../../util/rou"));
exports.storage = multer_1.default.diskStorage({
    destination: (req, file, cd) => {
        cd(null, path_1.default.resolve(__dirname, "../../public/img"));
    },
    filename: (req, file, cd) => {
        const filename = feifanc_1.default.date("all") + "-" + rou_1.default.rou(6) + path_1.default.extname(file.originalname);
        req.query.fileurl = "/img/" + filename;
        cd(null, filename);
    },
});
